package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteGgSearchService;
import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteGgSearchFallbackFactory implements FallbackFactory<RemoteGgSearchService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteGgSearchFallbackFactory.class);

    @Override
    public RemoteGgSearchService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteGgSearchService() {
            @Override
            public R<Boolean> goSearch(String source) {
                return null;
//                return R.fail("查询谷歌排名失败:" + throwable.getMessage());
            }
        };
    }
}
